#include <iostream>

using namespace std;

int a[] = {0, 1, 4, 3, 2, 6, 5};
int ans[7] = {0};

void lcs()
{
    ans[1] = 1;
    for (int i = 1; i <= 6; ++i)
    {
        int max = 1;
        for (int j = 1; j < i; ++j)
        {
            if (a[j] < a[i])
            {
                if (max < ans[j] + 1)
                {
                    max = ans[j] + 1;
                }
            }
        }
        ans[i] = max;
    }

    for (const int& i : ans)
    {
        cout << i << " ";
    }
    cout << endl;
}

int main(int argc, char *argv[])
{
    lcs();
    return 0;
}
